export const state = {
    // user:null
    user : sessionStorage.getItem('user') ? JSON.parse(sessionStorage.getItem('user')) : null,
}
export const mutations = {
    changeUser(state,data){
        state.user = data
        if(data){
            // 1.将用户信息存入state中
           
           sessionStorage.setItem("user",JSON.stringify(data))
         }else{
           sessionStorage.removeItem('user');
         }
    }
}
export const getters = {
    user(state){
        return state.user
    }
}
